<template>
  <div class="Music">
    <div class="header">
      <div class="header-left">
        <div @click="router.go(-1)"><i class="iconfont iconyoujiantou2"></i></div>
        <div @click="router.go(1)"><i class="iconfont iconyoujiantou"></i></div>
      </div>
      <div class="header-right">
        <div v-for="(item, index) in headerMenuConfig" :key="item.id">
          <span
            @click="
              router.push(item.router);
              currentItem = index;
            "
            :style="{ color: route.path === item.router ? '#fff' : '#8a8a8a' }"
            >{{ item.name }}</span
          >
        </div>
        <search-input></search-input>
      </div>
    </div>
    <div class="content">
      <router-view />
    </div>
    <footer>
      <music-footer></music-footer>
    </footer>
  </div>
</template>

<script lang="ts" setup>
import { computed, ref } from "vue";
import { useRouter, useRoute } from "vue-router";
import searchInput from "@/components/searchInput.vue";
import musicFooter from "@/components/musicFooter.vue";
const router = useRouter();
const route = useRoute();
type THeaderMenu = {
  name: string;
  router: string;
  id: number;
};
const currentItem = ref(0);
const headerMenuConfig = ref<Array<THeaderMenu>>([
  { name: "个性推荐", router: "/home/advice", id: 0 },
  { name: "歌单", router: "/home/song", id: 1 },
  { name: "排行榜", router: "/home/rank", id: 2 },
  { name: "歌手", router: "/home/singer", id: 3 },
  { name: "最新音乐", router: "/home/newMusic", id: 4 },
]);
</script>

<style lang="scss" scoped>
.Music {
  width: 1000px;
  height: 670px;
  position: absolute;
  left: 0;
  top: 50px;
  right: 0;
  bottom: 0;
  margin: auto;
  border-radius: 10px;
  overflow: hidden;
  z-index: 999;
  .header {
    width: 100%;
    height: 50px;
    display: flex;
    .header-left {
      box-sizing: border-box;
      padding: 0 50px 0 80px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: #b2b2b2;
      flex-basis: 200px;
      background-color: #2d2d2d;
      div {
        text-align: center;
        line-height: 26px;
        width: 26px;
        height: 26px;
        &:hover {
          color: #fff;
          background-color: #373737;
          border-radius: 50%;
        }
      }
      .iconfont {
        font-size: 18px;
        font-weight: bold;
      }
    }
    .header-right {
      flex: 1;
      background-color: #2a2a2a;
      display: flex;
      color: #8a8a8a;
      align-items: center;
      div {
        margin: 0 25px;
        font-size: 14px;
        font-weight: bold;
        &:hover {
          color: #b5b5b5;
          cursor: pointer;
        }
      }
      input {
        margin-left: 50px;
      }
    }
  }
  .content {
    width: 100%;
    height: 620px;
    background-color: #252525;
    overflow: scroll;
  }
}
</style>
